package com.wuchao.springandmybatis;

import com.wuchao.entity.User;
import com.wuchao.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author wuchao66
 * @Date 2022/7/5 10:19
 * @Version 1.0
 */
@Transactional(propagation = Propagation.REQUIRED,timeout = -1)
@Service("ShowSpringAndMybatis")
public class ShowSpringAndMybatis {

   /* @RequestMapping("show")
    public ModelAndView showUserList1(){
        ModelAndView modelAndView=new ModelAndView();
        List<User> userList = userService.findUserList();
        modelAndView.addObject("list",userList);
        modelAndView.setViewName("show.jsp");
        return modelAndView;
    }*/
    public void show(){
        System.out.println("注解事务");
    }
    @Resource
    UserService userService;
    public List<User> showUserList(){
       return userService.findUserList();
    }
}
